Skip to content

ITEP-71829 Add is_background label#686

Merged
A-Artemis merged 1 commit into
mainfrom
aurelien/ITEP-71829-add-is_background-label
Jul 14, 2025
Merged

ITEP-71829 Add is_background label#686
A-Artemis merged 1 commit into
mainfrom
aurelien/ITEP-71829-add-is_background-label

Conversation

@A-Artemis
Copy link
Copy Markdown
Contributor

@A-Artemis A-Artemis commented Jul 11, 2025

📝 Description

Adds a new parameter: is_background to the Label entity.
An annotation with a label whose is_background value is True will be used to cut the mask for semantic segmentation task.

✨ Type of Change

Select the type of change your PR introduces:

  • 🐞 Bug fix – Non-breaking change which fixes an issue
  • 🚀 New feature – Non-breaking change which adds functionality
  • 🔨 Refactor – Non-breaking change which refactors the code base
  • 💥 Breaking change – Changes that break existing functionality
  • 📚 Documentation update
  • 🔒 Security update
  • 🧪 Tests

🧪 Testing Scenarios

Describe how the changes were tested and how reviewers can test them too:

  • ✅ Tested manually
  • 🤖 Run automated end-to-end tests

✅ Checklist

Before submitting the PR, ensure the following:

  • 🔍 PR title is clear and descriptive
  • 📝 For internal contributors: If applicable, include the JIRA ticket number (e.g., ITEP-123456) in the PR title. Do not include full URLs
  • 💬 I have commented my code, especially in hard-to-understand areas
  • 📄 I have made corresponding changes to the documentation
  • ✅ I have added tests that prove my fix is effective or my feature works

Copilot AI review requested due to automatic review settings July 11, 2025 08:02
@A-Artemis A-Artemis requested a review from a team as a code owner July 11, 2025 08:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new is_background flag to the Label entity so that background labels can be identified and mapped correctly for semantic segmentation.

  • Extends Label constructor, docstring, and __repr__ to include is_background
  • Updates MongoDB mapper to forward and backward map the is_background field
  • Adjusts existing static mapper test to cover is_background in forward mapping

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/repos/mappers/test_static_mappers.py Added is_background=True to the Label in the mapper test
iai_core/repos/mappers/mongodb_mappers/label_mapper.py Included is_background in forward and backward mappings
iai_core/entities/label.py Added is_background parameter, storage, docstring entry, and updated __repr__
Comments suppressed due to low confidence (2)

interactive_ai/libs/iai_core_py/tests/repos/mappers/test_static_mappers.py:330

  • Add a test case for backward mapping when is_background is omitted to ensure the default value of False is correctly applied by LabelToMongo.backward.
            is_background=True,

interactive_ai/libs/iai_core_py/iai_core/entities/label.py:102

  • [nitpick] Consider updating any user-facing or generated API documentation (e.g., Sphinx/RST docs) to include the new is_background parameter under the Label reference section.
    :param is_background: boolean that indicates whether the label is the background label.

@github-actions github-actions Bot added the IAI Interactive AI backend label Jul 11, 2025
@MarkRedeman MarkRedeman linked an issue Jul 11, 2025 that may be closed by this pull request
@A-Artemis A-Artemis self-assigned this Jul 14, 2025
@A-Artemis A-Artemis added this pull request to the merge queue Jul 14, 2025
Merged via the queue into main with commit f736afa Jul 14, 2025
24 checks passed
@A-Artemis A-Artemis deleted the aurelien/ITEP-71829-add-is_background-label branch July 14, 2025 12:13
@leoll2 leoll2 linked an issue Jul 15, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IAI Interactive AI backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add is_background field to Label Holes in annotation shapes

3 participants